package main

import (
	"net/http"
	// "strconv"
	// "echotest/manager"
	"echotest/hllyun/volumes"
	"fmt"
	"github.com/donnie4w/go-logger/logger"
	"github.com/labstack/echo"
	"github.com/labstack/echo/middleware"
)

func logInit() {
	log_dir := "/var/log/"
	log_file := "hllyun.log"
	logger.SetConsole(false)
	logger.SetLevelFile(logger.INFO, log_dir, log_file)
	logger.SetLevelFile(logger.WARN, log_dir, log_file)
	logger.SetLevelFile(logger.ERROR, log_dir, log_file)
}

func getVolumes(a echo.Context) error {
	return a.String(http.StatusOK, volumes.GetAllVolumes1())
}

func structmthodtest() {
	var a volumes.Volume
	fmt.Println(a.Create_volume())
}

func main() {
	logInit()
	e := echo.New()
	e.Use(middleware.Logger())
	e.Use(middleware.Recover())
	e.GET("/", getVolumes)
	// a := volumes.GetAllVolumes1()
	// fmt.Println(a)
	volumes.GetAllVolumes2()
	volumes.Structtest()
	structmthodtest()
	volumes.Test_exception()
	e.Logger.Fatal(e.Start(":1323"))
}
